package com.flower.controller.admin;

import com.flower.domain.vo.admin.area.FlowerEncyclopediaArea;
import com.flower.domain.vo.admin.area.OrderArea;
import com.flower.service.AreaAnalysisService;
import com.flower.utils.AjaxResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 管理端地区分析
 */
@RestController
@RequestMapping("/admin/area")
@RequiredArgsConstructor
@Slf4j
public class AreaAnalysisController {

    private final AreaAnalysisService areaAnalysisService;

    /**
     * 获取各个省市的花卉种类数量
     * @return
     */
    @GetMapping("/specie")
    public AjaxResult getSpecieWithProvince() {
        List<FlowerEncyclopediaArea> flowerEncyclopediaAreas = areaAnalysisService.getSpecieWithProvince();
        return AjaxResult.success(flowerEncyclopediaAreas);
    }

    /**
     * 获取各个省市的花卉售卖种类
     */
    @GetMapping("/sale")
    public AjaxResult getSaleWithProvince   () {
        List<OrderArea> orderAreas = areaAnalysisService.getSaleWithProvince();
        return AjaxResult.success(orderAreas);
    }
}
